//
//  HLBaseCollectionCell.m
//  s.
//
//  Created by fanshijian on 2022/8/24.
//  Copyright © 2022 J. All rights reserved.
//

#import "BaseCollectionCell.h"

@implementation BaseCollectionCell

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.bottomInsets = kEdge(0, 16, 0, 16);
    }
    return self;
}

- (void)setModel:(BaseModel *)model {
    if (self.model != model || model.modified) {
        [super setModel:model];
        model.modified = NO;
        self.zh_action = model.action;
    }
}

- (UIView *)klBottomLine {
    if (!_klBottomLine) {
        UIView *obj = [UIView new];
        [self.contentView addSubview:_klBottomLine = obj];
        obj.hidden = YES;
        [obj setBackgroundColor:KLColorWithAlpha(@"#000000", 0.1)];
        [obj mas_makeConstraints:^(MASConstraintMaker *make) {
            kMakeLV(self.bottomInsets.left);
            kMakeRV(-self.bottomInsets.right);
            kMakeBV(0);
            kMakeHV((self.lineH!=nil)?self.lineH.floatValue:1);
        }];
    }
    return _klBottomLine;
}

- (void)setBottomColor:(UIColor *)bottomColor {
    [self.klBottomLine setBackgroundColor:bottomColor];
}

@end
